package main

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

/**
 *
 * @param root TreeNode类
 * @return int整型二维数组
 */
func levelOrder(root *TreeNode) [][]int {
	// write code here
	NC15dfs(root, 0)
	return NC15ans
}

var NC15ans = make([][]int, 0)

func NC15dfs(pRoot *TreeNode, num int) {
	if pRoot == nil {
		return
	}
	if len(NC15ans) == num {
		NC15ans = append(NC15ans, []int{})
	}
	NC15ans[num] = append(NC15ans[num], pRoot.Val)
	NC15dfs(pRoot.Left, num+1)
	NC15dfs(pRoot.Right, num+1)
}
